//package com.yunxin.admin.system.api.core.popup;
//
//
//import com.yunxin.admin.system.infra.common.constant.SecurityConstants;
//import com.yunxin.admin.system.infra.framework.resubmit.Resubmit;
//import com.yunxin.admin.system.infra.framework.security.util.SecurityUtils;
//import com.yunxin.admin.system.infra.framework.syslog.AutoLog;
//import com.yunxin.common.result.Result;
//import com.yunxin.core.application.command.popup.AddProductsCommand;
//import com.yunxin.core.application.command.popup.ProductOptionsCommand;
//import com.yunxin.core.application.command.popup.SaveProductDataCommand;
//import com.yunxin.core.application.dto.popup.PopupProductsDTO;
//import com.yunxin.core.application.dto.popup.ProductOptionsDTO;
//import com.yunxin.core.application.service.PopupApplicationAdminService;
//import com.yunxin.core.application.service.PopupQueryAdminService;
//import io.swagger.v3.oas.annotations.Operation;
//import io.swagger.v3.oas.annotations.security.SecurityRequirement;
//import io.swagger.v3.oas.annotations.tags.Tag;
//import lombok.RequiredArgsConstructor;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.security.access.prepost.PreAuthorize;
//import org.springframework.validation.annotation.Validated;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
///**
// * @author zero°
// * @since 2023-12-11
// */
//@Tag(name = "81.推荐弹窗配置")
//@Slf4j
//@RestController
//@RequestMapping("/core/v1/popup/config")
//@RequiredArgsConstructor
//public class PopupConfigController {
//
//    private final PopupQueryAdminService popupQueryAdminService;
//
//    private final PopupApplicationAdminService popupApplicationAdminService;
//
//    @Operation(summary = "查询弹窗可选产品下拉框", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @PostMapping("/queryProductOptions")
//    public Result<ProductOptionsDTO> productOptions(@Validated @RequestBody ProductOptionsCommand command) {
//        return Result.success(popupQueryAdminService.productOptions(command));
//    }
//
//    @Operation(summary = "添加弹窗产品", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @PostMapping("/addProducts")
//    @PreAuthorize("@ss.hasPerm('core:popup_config:add')")
//    @Resubmit
//    @AutoLog(value = "添加弹窗产品")
//    public Result<Boolean> addProducts(@Validated @RequestBody AddProductsCommand command) {
//        command.setCreator(SecurityUtils.X.getUser().getUsername());
//        return Result.success(popupApplicationAdminService.addProducts(command));
//    }
//
//    @Operation(summary = "查询弹窗产品列表", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @PostMapping("/queryProductList")
//    public Result<PopupProductsDTO> queryProductList(@Validated @RequestBody ProductOptionsCommand command) {
//        return Result.success(popupQueryAdminService.queryProductList(command));
//    }
//
//    @Operation(summary = "保存产品配置", security = {@SecurityRequirement(name = SecurityConstants.TOKEN_KEY)})
//    @PostMapping("/saveProductData")
//    @PreAuthorize("@ss.hasPerm('core:popup_config:save')")
//    @Resubmit
//    @AutoLog(value = "保存产品配置")
//    public Result<Boolean> saveProductData(@Validated @RequestBody SaveProductDataCommand command) {
//        command.setEditor(SecurityUtils.X.getUser().getUsername());
//        return Result.success(popupApplicationAdminService.saveProductData(command));
//    }
//
//}
